﻿<Window x:Class="TestPlanMigration.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="TFS Test Plan Migration Tool" Height="500" Width="700"
        Style="{DynamicResource MainWindowStyle}">

    <Window.Resources>
        <ResourceDictionary>
            <!-- Icon + Logo from : http://www.iconarchive.com/show/ivista-2-icons-by-gakuseisean/Files-New-Window-icon.html -->
            <BitmapImage x:Key="ApplicationIcon" UriSource="/TestPlanMigration;component/Resources/TestPlanMigration.ico" />
            <BitmapImage x:Key="ApplicationLogo" UriSource="/TestPlanMigration;component/Resources/TestPlanMigration.png" />
            <Style x:Key="MainWindowStyle" TargetType="Window">
                <Setter Property="Icon" Value="{DynamicResource ApplicationIcon}" />
                <Setter Property="ShowInTaskbar" Value="True" />
                <Setter Property="WindowState" Value="Maximized" />
                <Setter Property="Topmost" Value="False" />
                <Setter Property="ResizeMode" Value="CanResize" />
                <Setter Property="WindowStyle" Value="SingleBorderWindow" />
            </Style>
        </ResourceDictionary>
    </Window.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="110" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid Margin="12,12,0,0" Grid.Row="0">
            
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            
            <Image Name="ImageLogo" Stretch="Uniform" Source="{DynamicResource ApplicationLogo}" Grid.Column="0" />
            <StackPanel Orientation="Vertical" Margin="5,0,0,0" Grid.Column="1">
                <StackPanel Orientation="Horizontal" Margin="0,5,12,0">
                    <Button x:Name="ButtonSourceConnect"  Content="Source TFS" Width="110" Height="25" Click="ButtonSourceConnectClick" />
                    <Label x:Name="LabelSource" Content="..." Height="25" Margin="5,0,0,0" />
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="0,5,12,0">
                    <Button x:Name="ButtonDestinationConnect" Content="Destination TFS" Width="110" Height="25" Click="ButtonDestinationConnectClick" IsEnabled="False" />
                    <Label x:Name="LabelDestination" Content="..." Height="25" Margin="5,0,0,0" />
                </StackPanel>
                <StackPanel Orientation="Horizontal" Margin="0,5,12,0" HorizontalAlignment="Right">
                    <Button x:Name="ButtonMigrate" Content="Migrate Test Plans" Width="120" Height="25" Click="MigrateClick" IsEnabled="False" />
                </StackPanel>
            </StackPanel>            
        </Grid>

        <TreeView Margin="12,12,12,12" x:Name="TreeMain" Grid.Row="1" PreviewMouseRightButtonDown="TreeMainPreviewMouseRightButtonDown" SelectedItemChanged="TreeMainSelectedItemChanged">
            <TreeView.Resources>
                <ContextMenu x:Key ="PlanContextMenu" StaysOpen="true">
                    <MenuItem Header="Export full test plan to CSV..." Click="ExportToCsvClick" IsEnabled="{Binding ElementName=ButtonDestinationConnect, Path=IsEnabled}" />
                </ContextMenu>
                <ContextMenu x:Key ="SuiteContextMenu" StaysOpen="true">
                    <MenuItem Header="Export full test suite to CSV..." Click="ExportToCsvClick" IsEnabled="{Binding ElementName=ButtonDestinationConnect, Path=IsEnabled}" />
                </ContextMenu>
                <ContextMenu x:Key ="CaseContextMenu" StaysOpen="true">
                    <MenuItem Header="Export test case to CSV..." Click="ExportToCsvClick" IsEnabled="{Binding ElementName=ButtonDestinationConnect, Path=IsEnabled}" />
                </ContextMenu>
            </TreeView.Resources>
        </TreeView>

    </Grid>

</Window>
